﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InstaMe.DB
{
    public class QueryObject
    {
        public const int KEY_OBJECT_INSERT                   = 1;
        public const int KEY_FROM_ID = 2;
        public const int KEY_ID_REMOVE = 3;
        public const int KEY_LIST_DIARY_ITEM_RETURN = 4;

        public const byte DB_INSERT_DIARY_ITEM              = 1;
        public const byte DB_FORCE_SUBMIT_CHANGES = 2;
        public const byte DB_LOAD_DIARY_ITEM = 3;
        public const byte DB_REMOVE_DIARY_ITEM = 4;
       

        private byte mAction;
        private Dictionary<int, object> mParams;
        private IDBListener mListener;
        private int mRequestId = 0;

        public QueryObject()
        {
            mParams = new Dictionary<int, object>();
            mListener = null;
        }

        public void setAction(byte aAction)
        {
            mAction = aAction;
        }

        public byte getAction()
        {
            return mAction;
        }

        public void setParam(int aKey, object aValue)
        {
            if (mParams.ContainsKey(aKey))
            {
                mParams.Remove(aKey);
            }
            mParams.Add(aKey, aValue);
        }

        public object getParam(int aKey)
        {
            if (mParams.ContainsKey(aKey))
            {
                return mParams[aKey];
            }
            return null;
        }

        public void setListener(IDBListener aListener)
        {
            mListener = aListener;
        }

        public IDBListener getListener()
        {
            return mListener;
        }

        public void setRequestId(int aRequestId)
        {
            mRequestId = aRequestId;
        }

        public int getRequestId()
        {
            return mRequestId;
        }
    }
}
